package org.example.game.history;

/**
 * @Description: TODO
 * @Author wyatt
 * @Data 2024/07/21 11:00
 */
public class Solution100360 {

    public static void main(String[] args) {
        System.out.println(new Solution100360().maxOperations("10001101"));
    }

    public int maxOperations(String s) {
        int count = 0;
        int countNumOne = 0;
        int per = -1;
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == '1'){
                countNumOne++;
                per = 1;
            }else {
                if(per == 1) count+=countNumOne;
                per = 0;
            }
        }
        return count;
    }
}
